export function setLocal(key, value){
    let jsonStr = JSON.stringify(value);
    localStorage.setItem(key,jsonStr);
}

export function getLocal(key) {
    return JSON.parse(localStorage.getItem(key));
}

export function setSession(key, value){
    let jsonStr = JSON.stringify(value);
    sessionStorage.setItem(key,jsonStr);
}

export function getSession(key) {
    return JSON.parse(sessionStorage.getItem(key));
}


export function getDynamicRouter(key) {
    let dynamicRouter = JSON.parse(sessionStorage.getItem('dynamicRouter'));
    return dynamicRouter[key];
}

export function setDynamicRouter(key,router) {
    let dynamicRouter = getSession('dynamicRouter');
    if (!dynamicRouter){
        dynamicRouter = {};
    }
    dynamicRouter[key] = router;
    setSession('dynamicRouter',dynamicRouter);
}
